package org.jcut.service.impl;

import java.util.List;

import org.jcut.bean.Commodity;
import org.jcut.dao.ICommodity;
import org.jcut.service.ICommodityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
@Transactional
public class CommodityServiceImpl implements ICommodityService {
	@Autowired
	private ICommodity dao;

	@Override
	public int buyCommodity(Commodity commodity) {
		// TODO Auto-generated method stub
		 dao.cutStock(commodity);
		
		return dao.buyCommodity(commodity);
		
	}
	

	
	@Override
	public List<Commodity> selectTypeCommodity(String t_name) {
		// TODO Auto-generated method stub
		return dao.selectTypeCommodity(t_name);
	}

	@Override
	public List<Commodity> chooseCommodity(Commodity commodity) {
		return dao.chooseCommodity(commodity);
	}

	@Override
	public int returnCommodity(Commodity commodity) {
		// TODO Auto-generated method stub
		 dao.returnCommodity(commodity);
		 return dao.cutSales(commodity);
	}



	@Override
	public int addCommodity(Commodity commodity) {
		// TODO Auto-generated method stub
		return dao.addCommodity(commodity);
	}



	@Override
	public int updateDetail(Commodity commodity) {
		// TODO Auto-generated method stub
		return dao.updateDetail(commodity);
	}



	@Override
	public List<Commodity> adminSelect() {
		// TODO Auto-generated method stub
		return dao.adminSelect();
	}



	@Override
	public int updateDis(Commodity commodity) {
		// TODO Auto-generated method stub
		return dao.updateDis(commodity);
	}



	@Override
	public int updateCommodity(Commodity commodity) {
		// TODO Auto-generated method stub
		return dao.updateCommodity(commodity);
	}

}
